package com.pms.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.pms.pojo.Department;
import com.pms.pojo.DeptTurn;
import com.pms.pojo.LeaveEmployee;
import com.pms.pojo.NewEmployee;
import com.pms.pojo.PostTurn;
import com.pms.pojo.StatementRequire;
import com.pms.service.StatementsService;

@Controller
@RequestMapping("/statement")
public class PersonnelStatementController {
	
	@Resource(name="statementsService")
	private StatementsService statementsService;
	
	
	public void setDeptService(StatementsService statementsService) {
		this.statementsService = statementsService;
	}

		
		@RequestMapping("/newHire")
		public String newHirdStatement(StatementRequire Srequire ,Model  model) {
			List<NewEmployee> newEmployee = this.statementsService.getNewEmployee(Srequire);
			List<Department> department = this.statementsService.getDepartment();
			model.addAttribute("newEmployee", newEmployee);
			model.addAttribute("department", department);
			return "report_New_hires";
		}
		
		@RequestMapping("/departure")
		public String DepartureStatement(StatementRequire Srequire ,Model  model) {
			List<LeaveEmployee> leaveEmployee = this.statementsService.getLeavaEmployeeS(Srequire);
			List<Department> department = this.statementsService.getDepartment();
			model.addAttribute("leaveEmployee",leaveEmployee);
			model.addAttribute("department", department);
			
			return "report_Departing_employees";
		}
		
		@RequestMapping("/deptTurn")
		public String deptTurnStatement(StatementRequire Srequire ,Model  model) {
			List<DeptTurn> deptTurn = this.statementsService.getDeptTurn(Srequire);
			model.addAttribute("deptTurn",deptTurn);
			 return "report_Departments_mobilize";
		}
		
		@RequestMapping("/postTurn")
		public String postTurnStatement(StatementRequire Srequire ,Model  model) {
			List<PostTurn> postTurn = this.statementsService.getPostTurn(Srequire);
			System.out.println(postTurn);
			model.addAttribute("postTurn",postTurn);
			return "report_Job_transfer";
		}
		
		@RequestMapping("/month")
		public String monthStatement() {
			return "report_monthly_report";
		}
}



